package org.sky.cloud.common.task;

public abstract class AbstractDelayTask<T> implements DelayTask<T>{

    private long taskInterval;

    private long lastProcessTime;

    public long getTaskInterval() {
        return taskInterval;
    }

    public void setTaskInterval(long taskInterval) {
        this.taskInterval = taskInterval;
    }

    public long getLastProcessTime() {
        return lastProcessTime;
    }

    public void setLastProcessTime(long lastProcessTime) {
        this.lastProcessTime = lastProcessTime;
    }


    @Override
    public boolean shouldProcess() {
        return (System.currentTimeMillis() - this.lastProcessTime >= this.taskInterval);
    }
}
